<template>
  <div>
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive"/>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"/>
  </div>
</template>

<script>
import '@/assets/css/normalize.css'
  export default {
    request: function(url, data = {}, method = 'GET') {
			// console.log(url,data,method,codetype)
			let t = this;
			var promise = new Promise((resolve, reject) => {
				uni.request({
					url: t.globalData.baseUrl + url,
					data: data,
					method: method || 'POST',
					header: {
						'Content-type': method == 'get' ? 'application/x-www-form-urlencoded' :
							'application/json',
						token: uni.getStorageSync('token') || '9406f797-221e-4511-be9e-f411728c2e84'
					},
					emulateJSON: true,
					success: function(res) {
						resolve(res.data);
					},
					fail: function(e) {
						uni.hideLoading()
						reject('网络出错');
						uni.hideNavigationBarLoading();
						uni.showToast({
							title: '网络有误，请稍后重试吧~',
							icon: 'none',
							duration: 1300
						});
					},
					complete: function(daa) {}
				});
			});
			return promise;
		},
  }
</script>

<style lang="scss" scoped>

</style>